package com.kate.mall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.kate.mall.common.utils.PageUtils;
import com.kate.mall.order.controller.form.CouponVO;
import com.kate.mall.order.controller.form.OrderVO;
import com.kate.mall.order.dto.GrouponRulesDTO;
import com.kate.mall.order.dto.OrderDTO;
import com.kate.mall.order.entity.OrderEntity;

import java.math.BigDecimal;
import java.util.Map;
import java.util.Optional;

/**
 * 订单表
 *
 * @author kate-chan
 * @email 857782993@qq.com
 * @date 2022-12-16 10:48:44
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    Optional<OrderDTO> submit(Integer userId, OrderDTO clone)throws Exception;


    Optional<OrderDTO>  calculateOrderPrice(OrderDTO orderDTO)throws Exception;

    //OrderDTO calculateCouponDiscountPrice(OrderDTO clone, CouponDTO clone1) throws  Exception;

    Optional<OrderDTO> calculateOrderPrice(OrderDTO orderDTO,Integer userId) throws Exception;

    Optional<BigDecimal> calculateCouponDiscountPrice(OrderVO orderVO, CouponVO couponVO) throws Exception;

    Optional<BigDecimal> calculateGroupOnDiscountPrice(GrouponRulesDTO clone) throws Exception ;

    OrderDTO saveOrder(OrderDTO order) throws Exception;

    int updateWithOptimisticLocker(OrderEntity order);

    OrderEntity findBySn(String orderSn);
}

